<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>
	<title>祖龙娱乐  - BI系统</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../../js/highcharts.js"></script>
	<script type="text/javascript" src="../../js/drawChart.js"></script>
</h:head>

<h:body>
	<ui:param name="bean" value="#{serverRealTimeAction}" />
	
	<span class="pagetitle">实时数据 —— 分服概况</span>
	<p:separator />
	
	<!-- 右侧页面顶部查询部分 -->
	<h:form id="fsearch">
		<p:poll interval="20" listener="#{bean.search()}" update=":dform" />
	
		<p:growl id="growl" showDetail="true" sticky="true" />
		<h:outputLabel value="查看日期：" />
        <p:calendar value="#{bean.lookDate}" mode="popup" pattern="yyyy-MM-dd" />
		<h:outputLabel value="（数据更新频率为1分钟）" />
		&#160;&#160;&#160;
		
        <p:commandButton value="查询" action="#{bean.search()}" update=":data" ajax="false" />
	</h:form>
	<br />

	<!-- 数据展示部分，包含表格和图表 -->
	<h:form id="dform">
		<div class="data" id="data">
			<h:panelGrid columns="1" style="width:100%">
                <div id="basewidth" style="width:91%;height:0;border:0;">
				</div>
				<div id="basewidth2" style="width:94%;height:0;border:0;">
				</div>
            </h:panelGrid>
		
			<p:panel id="panel" header="分服详细数据" style="margin-bottom:10px;">
				<p:dataTable id="dlist" var="l" value="#{bean.serverRealTimeDetailDatas}" scrollable="true" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="15,30" rows="15" style="text-align:center;">
                    <p:column headerText="服务器名称" styleClass="column grcnewUser"  sortBy="#{l.serverid}">
						<h:outputLabel value="#{pageHelper.getServerNameById(l.serverid)}" />
					</p:column>
					<p:column headerText="在线人数" styleClass="column grcnewUser" sortBy="#{l.onlinenum}">
						<h:outputLabel value="#{l.onlinenum}" />
					</p:column>
					<p:column headerText="PCU" styleClass="column grcnewUser" sortBy="#{l.pcu}">
						<h:outputLabel value="#{l.pcu}" />
					</p:column>
					<p:column headerText="ACU" styleClass="column grcnewUser" sortBy="#{l.acu}">
						<h:outputLabel value="#{l.acu}" />
					</p:column>
					<p:column headerText="新增用户" styleClass="column grcnewUser" sortBy="#{l.newUser}">
						<h:outputLabel value="#{l.newUser}" />
					</p:column>
                    <p:column headerText="去重新增用户" styleClass="column grcloginNewUservalidatedRadio" sortBy="#{l.newUser}">
                        <h:outputLabel value="#{l.distinctNewUser}" />
                    </p:column>
					<p:column headerText="活跃用户" styleClass="column grcnewUser" sortBy="#{l.acitveUser}">
						<h:outputLabel value="#{l.acitveUser}" />
					</p:column>
					<p:column headerText="服务器容量" styleClass="column grcnewUser" sortBy="#{l.capacity}">
						<h:outputLabel value="#{l.capacity}" />
					</p:column>
					<p:column headerText="实时使用率" styleClass="column grcnewUser" sortBy="#{l.capacityUsedRadio}">
						<h:outputLabel value="#{pageHelper.double2Percent(l.capacityUsedRadio)}" />
					</p:column>
                    <p:column headerText="昨日PCU" styleClass="column grcnewUser" sortBy="#{l.pcuYesterday}">
                        <h:outputLabel value="#{l.pcuYesterday}" />
                    </p:column>
                    
                    <p:column headerText="付费账号数" styleClass="column grcnewUser" sortBy="#{l.cashUser}">
                        <h:outputLabel value="#{l.cashUser}" />
                    </p:column>
                    <p:column headerText="付费金额" styleClass="column grcnewUser" sortBy="#{l.cash}">
                        <h:outputLabel value="#{l.cash}" />
                    </p:column>
                    <p:column headerText="活跃付费率" styleClass="column grcnewUser" sortBy="#{l.activeUserPayRadio}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.activeUserPayRadio)}" />
                    </p:column>
                    <p:column headerText="昨日新增账号次留" styleClass="column grcloginNewUservalidatedRadio" sortBy="#{l.the2Left}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the2Left)}" />
                    </p:column>
                    <p:column headerText="昨日新增设备次留" styleClass="column grcloginNewUservalidatedRadio" sortBy="#{l.mac2Left}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.mac2Left)}" />
                    </p:column>
                    
					<p:column headerText="昨日最高使用率" styleClass="column grcloginNewUservalidatedRadio" sortBy="#{l.maxCapacityUsedRadioYesterday}">
						<h:outputLabel value="#{pageHelper.double2Percent(l.maxCapacityUsedRadioYesterday)}" />
					</p:column>
					
					<p:columnGroup type="footer">
	            		<p:row>
		               		<p:column footerText="总计" styleClass="column grcnewUser"/>
		               		<p:column footerText="#{bean.allSumServerRealTimeDetailData.onlinenum}" styleClass="column grcnewUser"/>
		                	<p:column footerText="#{bean.allSumServerRealTimeDetailData.pcu}" styleClass="column grcnewUser"/>
		                	<p:column footerText="#{bean.allSumServerRealTimeDetailData.acu}" styleClass="column grcnewUser"/>
		                	<p:column footerText="#{bean.allSumServerRealTimeDetailData.newUser}" styleClass="column grcnewUser"/>
                            <p:column footerText="#{bean.allSumServerRealTimeDetailData.distinctNewUser}" styleClass="column grcnewUser"/>
		                	<p:column footerText="#{bean.allSumServerRealTimeDetailData.acitveUser}" styleClass="column grcloginNewUservalidatedRadio"/>
		                	<p:column footerText="#{bean.allSumServerRealTimeDetailData.capacity}" styleClass="column grcnewUser"/>
		                	<p:column footerText="#{pageHelper.double2Percent(bean.allSumServerRealTimeDetailData.capacityUsedRadio)}" styleClass="column grcnewUser"/>
                            <p:column footerText="#{bean.allSumServerRealTimeDetailData.pcuYesterday}" styleClass="column grcnewUser"/>
                            
                            <p:column footerText="#{bean.allSumServerRealTimeDetailData.cashUser}" styleClass="column grcnewUser"/>
                            <p:column footerText="#{bean.allSumServerRealTimeDetailData.cash}" styleClass="column grcnewUser"/>
                            <p:column footerText="#{pageHelper.double2Percent(bean.allSumServerRealTimeDetailData.activeUserPayRadio)}" styleClass="column grcnewUser"/>
                            <p:column footerText="#{pageHelper.double2Percent(bean.allSumServerRealTimeDetailData.the2Left)}" styleClass="column grcloginNewUservalidatedRadio"/>
                            <p:column footerText="#{pageHelper.double2Percent(bean.allSumServerRealTimeDetailData.mac2Left)}" styleClass="column grcloginNewUservalidatedRadio"/>
                            
                            
		                	<p:column footerText="#{pageHelper.double2Percent(bean.allSumServerRealTimeDetailData.maxCapacityUsedRadioYesterday)}" styleClass="column grcloginNewUservalidatedRadio"/>
	            		</p:row>
        			</p:columnGroup>
				</p:dataTable>
			</p:panel>

            <p:separator />
            <p:panel id="panel2" header="全服在线（Top20） ——  #{bean.lastMaxOnlineNumStr}；#{bean.serverNumStr}" style="margin-bottom:10px;" rendered="#{bean.renderOnlineData()}">
                <p:selectOneButton value="#{bean.selectedItem}" rendered="#{pageHelper.isServerClass()}">
                    <f:selectItem itemLabel="全部平台" itemValue="all" />
                    <f:selectItem itemLabel="ios正版" itemValue="ioszb" />
                    <f:selectItem itemLabel="混服" itemValue="hf" />
                    <f:selectItem itemLabel="应用宝" itemValue="yyb" />
                    <f:selectItem itemLabel="硬核联盟" itemValue="yhlm" />
                    <p:ajax update="panel2" listener="#{bean.selectItem}" />
                </p:selectOneButton>

                <h:panelGrid columns="1" style="width:100%">
                    <div id="highchartChart0" style="width:99%;height:0; border:0;">
                    </div>
                </h:panelGrid>

                <p:dataGrid id="chart" var="c" value="#{bean.chartData}" columns="1" layout="grid">
                    <div id="highchartChart" style="width:100%;height:440px; border:0;">
                        <script type="text/javascript">
                            generateChart('#{c.jsonStr}', 'columnline', '', 'highchartChart0');
                        </script>
                    </div>
                </p:dataGrid>

                <p:accordionPanel activeIndex="-1">
                    <p:tab title="点击查看全服在线详细数据">
                        <p:dataTable id="dlist2" var="l" value="#{bean.detailDatas}" style="margin-top:10px">
                            <f:facet name="{Exporters}">
                                <h:commandLink  styleClass="exporter">
                                    <p:graphicImage url="/resources/images/excel.png" height="25px"/>
                                    <p:dataExporter type="xls" target="dlist2" fileName="serverOnline-#{pageHelper.getNewDateDetailStr()}"/>
                                </h:commandLink>
                            </f:facet>

                            <p:column headerText="大区" styleClass="column grcnewUser"  sortBy="#{l.serverid}">
                                <h:outputLabel value="#{l.itemName}" />
                            </p:column>
                            <p:column headerText="服务器ID" styleClass="column grcnewUser"  sortBy="#{l.serverid}">
                                <h:outputLabel value="#{l.serverid}" />
                            </p:column>
                            <p:column headerText="服务器名称" styleClass="column grcnewUser"  sortBy="#{l.serverid}">
                                <h:outputLabel value="#{l.servername}" />
                            </p:column>
                            <p:column headerText="在线人数" styleClass="column grcnewUser"  sortBy="#{l.serverid}">
                                <h:outputLabel value="#{l.onlinenum}" />
                            </p:column>
                        </p:dataTable>
                    </p:tab>
                </p:accordionPanel>
            </p:panel>

			<p:separator />
            <p:panel id="panel4" header="分服实时数据" style="margin-bottom:10px;" >
                <p:remoteCommand name="executeOnOnhide2" update="tabView2" action="#{bean.handleServerChange2}"/>

                <p:tabView id="tabView2">
                    <p:ajax event="tabChange" listener="#{bean.onCompareTabChange}" update="chart21 chart22"/>

                    <p:tab id="online" title="在线">
                        <p:selectCheckboxMenu id="servers21" value="#{bean.selectedServers21}" label="区服" filter="true" filterMatchMode="contains" panelStyle="width:160px" onHide="executeOnOnhide2();">
                            <f:selectItems value="#{bean.serverItmes}" />
                        </p:selectCheckboxMenu>
                        <p:dataGrid id="chart21" var="c" value="#{bean.serverRealTimeChart}" columns="1" layout="grid">
                            <p:panel style="text-align:center">
                                <h:panelGrid columns="1" style="width:100%">
                                <div id="highchartChart21" style="width:100%;height:400px; border:0;">
                                    <script type="text/javascript">
                                        generateChart('#{c.jsonStr}', 'linemore', '21', 'basewidth');
                                    </script>
                                </div>
                                </h:panelGrid>
                            </p:panel>
                        </p:dataGrid>
                    </p:tab>
                    <p:tab id="newUser" title="新增">
                        <p:selectCheckboxMenu id="servers22" value="#{bean.selectedServers22}" label="区服" filter="true" filterMatchMode="contains" panelStyle="width:160px" onHide="executeOnOnhide2();">
                            <f:selectItems value="#{bean.serverItmes}" />
                        </p:selectCheckboxMenu>
                        <p:dataGrid id="chart22" var="c" value="#{bean.serverRealTimeChart}" columns="1" layout="grid">
                            <p:panel style="text-align:center">
                                <h:panelGrid columns="1" style="width:100%">
                                <div id="highchartChart22" style="width:100%;height:400px; border:0;">
                                    <script type="text/javascript">
                                        generateChart('#{c.jsonStr}', 'linemore', '22', 'basewidth');
                                    </script>
                                </div>
                                </h:panelGrid>
                            </p:panel>
                        </p:dataGrid>
                    </p:tab>
                    <p:tab id="activeUser" title="活跃" rendered="false">
                        <p:selectCheckboxMenu id="servers23" value="#{bean.selectedServers23}" label="区服" filter="true" filterMatchMode="contains" panelStyle="width:160px" onHide="executeOnOnhide2();">
                            <f:selectItems value="#{bean.serverItmes}" />
                        </p:selectCheckboxMenu>
                        <p:dataGrid id="chart23" var="c" value="#{bean.serverRealTimeChart}" columns="1" layout="grid" rendered="false">
                            <p:panel style="text-align:center">
                                <h:panelGrid columns="1" style="width:100%">
                                <div id="highchartChart23" style="width:100%;height:400px; border:0;">
                                    <script type="text/javascript">
                                        generateChart('#{c.jsonStr}', 'linemore', '23', 'basewidth');
                                    </script>
                                </div>
                                </h:panelGrid>
                            </p:panel>
                        </p:dataGrid>
                    </p:tab>
                </p:tabView>
            </p:panel>
		</div>
	</h:form>

	<!-- 页脚 -->
	<div class="footer"></div>
</h:body>
</html>